package jpaintball;


import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import javax.imageio.ImageIO;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author ondra
 */
abstract public class ImageManager {

    private static final String IMGPATH = "/images/";
    // constants
    public static final int IMG_FIELD = 0;
    public static final int IMG_PLAYER_BLUE = 1;
    public static final int IMG_PLAYER_RED = 2;
    public static final int IMG_SMALL_BUNKER = 3;
    public static final int IMG_BIG_BUNKER = 4;

    private static ArrayList<Image> images;

    public static void loadImages() {

        // initialize list
        images = new ArrayList();

        loadImage(IMG_FIELD, "field.jpg");
        loadImage(IMG_PLAYER_BLUE, "player_blue.png");
        loadImage(IMG_PLAYER_RED, "player_red.png");
        loadImage(IMG_SMALL_BUNKER, "bunker_small.png");
        loadImage(IMG_BIG_BUNKER,"bunker_big.png");

    }

    private static void loadImage(int c, String filename) {

        URL url = ImageManager.class.getResource(IMGPATH + filename);
        System.out.println(url);
        Image img = Toolkit.getDefaultToolkit().getImage(url);
        images.add(c, img);

    }


    public static Image getImage(int c) {
        return images.get(c);
    }

}
